<?php
class Db_UserManagement extends MVC_SQL {
	public function __construct(){
		$this->setTable('ams_admin');
	}
	
	public function getListUser($oModel)
	{
		$oModel->oNavigator = new paging();
		$page_size = $oModel->getData('page_size');
		$pagegroup_size = $oModel->getData('pagegroup_size');
		$stylesheet = $oModel->getData('stylesheet');
		
		$sSql="SELECT * FROM ams_admin WHERE admin_parent = 0";
		
		$total_record = $this->getNumRow($sSql);
		$oModel->oNavigator->init($sSql, $total_record, $page_size, $pagegroup_size, 'pUser', $stylesheet);
		$sSql = $oModel->oNavigator->getSql();
		return $this->getRecordsetExtend($sSql);
	}
	
	public function updateUser($aData)
	{
		return $this->doUpdateByPK($aData);
	}
	
	public function getInfoUser($iId){
		return $this->getRecordsetByPK($iId);
	}
        public function getTemplate(){
            $sql = "SELECT * FROM ams_template WHERE status = 1";
            return $this->getRecordsetExtend($sql);
        }
        public function getRootCategory(){
            $sql = "SELECT * FROM ams_product_category WHERE product_category_parent_id = 0";
            return $this->getRecordsetExtend($sql);
        }
        
		
}
?>